import 'package:flutter/material.dart';

/*
 * @author[hansen]
 * @version[创建日期，2022/5/27 18:10]
 * @function[图标-文本-图标排版]
 */

class IconTextIconWidget extends StatelessWidget {
  final double? iconWidth;
  final double? iconHeight;
  final String? iconName;
  final String? text;
  final TextStyle? textStyle;
  final double? arrowIconWidth;
  final double? arrowIconHeight;
  final String? arrowIconName;
  final EdgeInsetsGeometry? padding;
  final EdgeInsetsGeometry? margin;
  final CrossAxisAlignment crossAxisAlignment;

  const IconTextIconWidget({
    Key? key,
    this.iconWidth,
    this.iconHeight,
    this.iconName,
    this.text,
    this.textStyle,
    this.arrowIconWidth,
    this.arrowIconHeight,
    this.arrowIconName,
    this.padding,
    this.margin,
    this.crossAxisAlignment = CrossAxisAlignment.center,
  })  : assert(text != null),
        assert(iconName != null),
        assert(arrowIconName != null),
        super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: margin,
      padding: padding ?? const EdgeInsets.fromLTRB(15, 15, 15, 15),
      child: Row(
        crossAxisAlignment: crossAxisAlignment,
        children: [
          Image.asset(
            iconName.toString(),
            width: iconWidth ?? 30,
            height: iconHeight ?? 30,
          ),
          const VerticalDivider(
            width: 10,
            color: Colors.white,
          ),
          Expanded(
            child: Text(
              text.toString(),
              style: textStyle ??
                  const TextStyle(
                    color: Color(0xFF303133),
                    fontSize: 14,
                  ),
            ),
          ),
          const VerticalDivider(
            width: 10,
            color: Colors.white,
          ),
          Image.asset(
            arrowIconName.toString(),
            width: arrowIconWidth ?? 18,
            height: arrowIconHeight ?? 18,
          ),
        ],
      ),
    );
  }
}
